package o;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.os.Build.VERSION;
import android.view.View;
import android.view.animation.Interpolator;
import java.lang.ref.WeakReference;

public final class ic {
    int ˊ = -1;
    Runnable ˋ = null;
    private WeakReference<View> ˏ;
    Runnable ॱ = null;

    static class d implements ib {
        boolean ˊ;
        ic ˏ;

        d(ic icVar) {
            this.ˏ = icVar;
        }

        public void ˏ(View view) {
            ib ibVar;
            this.ˊ = false;
            if (this.ˏ.ˊ > -1) {
                view.setLayerType(2, null);
            }
            if (this.ˏ.ॱ != null) {
                Runnable runnable = this.ˏ.ॱ;
                this.ˏ.ॱ = null;
                runnable.run();
            }
            Object tag = view.getTag(2113929216);
            if (tag instanceof ib) {
                ibVar = (ib) tag;
            } else {
                ibVar = null;
            }
            if (ibVar != null) {
                ibVar.ˏ(view);
            }
        }

        public void ˎ(View view) {
            if (this.ˏ.ˊ > -1) {
                view.setLayerType(this.ˏ.ˊ, null);
                this.ˏ.ˊ = -1;
            }
            if (VERSION.SDK_INT >= 16 || !this.ˊ) {
                ib ibVar;
                if (this.ˏ.ˋ != null) {
                    Runnable runnable = this.ˏ.ˋ;
                    this.ˏ.ˋ = null;
                    runnable.run();
                }
                Object tag = view.getTag(2113929216);
                if (tag instanceof ib) {
                    ibVar = (ib) tag;
                } else {
                    ibVar = null;
                }
                if (ibVar != null) {
                    ibVar.ˎ(view);
                }
                this.ˊ = true;
            }
        }

        public void ˋ(View view) {
            ib ibVar;
            Object tag = view.getTag(2113929216);
            if (tag instanceof ib) {
                ibVar = (ib) tag;
            } else {
                ibVar = null;
            }
            if (ibVar != null) {
                ibVar.ˋ(view);
            }
        }
    }

    public ic(View view) {
        this.ˏ = new WeakReference(view);
    }

    public ic ˏ(long j) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().setDuration(j);
        }
        return this;
    }

    public ic ˏ(float f) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().alpha(f);
        }
        return this;
    }

    public ic ॱ(float f) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().translationY(f);
        }
        return this;
    }

    public long ॱ() {
        View view = (View) this.ˏ.get();
        if (view != null) {
            return view.animate().getDuration();
        }
        return 0;
    }

    public ic ˊ(Interpolator interpolator) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().setInterpolator(interpolator);
        }
        return this;
    }

    public ic ˊ(long j) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().setStartDelay(j);
        }
        return this;
    }

    public void ˏ() {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().cancel();
        }
    }

    public void ˎ() {
        View view = (View) this.ˏ.get();
        if (view != null) {
            view.animate().start();
        }
    }

    public ic ॱ(ib ibVar) {
        View view = (View) this.ˏ.get();
        if (view != null) {
            if (VERSION.SDK_INT >= 16) {
                ˊ(view, ibVar);
            } else {
                view.setTag(2113929216, ibVar);
                ˊ(view, new d(this));
            }
        }
        return this;
    }

    private void ˊ(final View view, final ib ibVar) {
        if (ibVar != null) {
            view.animate().setListener(new AnimatorListenerAdapter(this) {
                final /* synthetic */ ic ˊ;

                public void onAnimationCancel(Animator animator) {
                    ibVar.ˋ(view);
                }

                public void onAnimationEnd(Animator animator) {
                    ibVar.ˎ(view);
                }

                public void onAnimationStart(Animator animator) {
                    ibVar.ˏ(view);
                }
            });
        } else {
            view.animate().setListener(null);
        }
    }

    public ic ॱ(final ih ihVar) {
        final View view = (View) this.ˏ.get();
        if (view != null && VERSION.SDK_INT >= 19) {
            AnimatorUpdateListener animatorUpdateListener = null;
            if (ihVar != null) {
                animatorUpdateListener = new AnimatorUpdateListener(this) {
                    final /* synthetic */ ic ॱ;

                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        ihVar.ˏ(view);
                    }
                };
            }
            view.animate().setUpdateListener(animatorUpdateListener);
        }
        return this;
    }
}
